home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / lisp / elk-2_0.lha / elk-2.0 / contrib / zelk / scm / toplevel < prev    next >
Encoding:
Text File  |  1992-11-13  |  1.2 KB  |  46 lines

  1. ;; toplevel. loaded to start reploop if interactive session (not -l )
  2. ;; modified
  3. ;; 20apr    interactive version of error handler==original version
  4. ;; 2jan
  5. ;; 4sep: split all non-toplevel stuff into "basics"
  6.  
  7. (set! autoload-notify? #f)    ;be silent if script
  8. (require 'basics)
  9.  
  10. ;;; if we arrive here, this must be an interactive session
  11. (set! autoload-notify? #t)
  12. ;(display 'toplevel)(newline)
  13.  
  14. ;; interactive version of the error handler
  15. (set! error-handler
  16.   (lambda error-msg
  17.     (error-print error-msg)
  18.     (let loop ()
  19.       (if (call-with-current-continuation
  20.        (lambda (control-point)
  21.          (push-frame control-point)
  22.          (rep-loop (the-environment))
  23.          #f))
  24.       ;; lambda will return #f on eof, in which case we fall out
  25.       ;; below the let, do pop-frame and invoke the next frame with #t.
  26.       ;; If the next frame is also an error, we are back here and
  27.       ;; go into this begin, which will in turn probably be exited with ^D
  28.       ;; The last frame will always be a toplevel frame.
  29.       (begin            ;then
  30.         (pop-frame)
  31.         ;(format #t "errloop begin~%")
  32.         (loop)
  33.       );begin
  34.       );if
  35.     );let
  36.     ;(format #t "error-handler past loop~%")
  37.     (newline)
  38.     (pop-frame)
  39.     (let ((next-frame (car rep-frames)))
  40.       (next-frame #t))
  41.   );lambda
  42. );set
  43.  
  44. (the-top-level)
  45.  
  46.